package com.zcoj.controller.User.contest;

import com.zcoj.core.model.ApiResponse;
import com.zcoj.core.model.PageWrap;
import com.zcoj.pojo.Dto.ContestAnnouncement;
import com.zcoj.service.ContestAnnouncementService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 接口
 * @author 剩xia的盛夏
 * @date 2023/02/24 16:16
 */
@RestController
@RequestMapping("/contestAnnouncement")
@Api(tags = "接口")
public class ContestAnnouncementController {

    @Autowired
    private ContestAnnouncementService contestAnnouncementService;
    /**
     * 分页查询
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @PostMapping("/page")
    @ApiOperation("分页查询")
    public ApiResponse findPage (@RequestBody PageWrap<ContestAnnouncement> pageWrap) {
        return ApiResponse.success(contestAnnouncementService.findPage(pageWrap));
    }

    /**
     * 通过ID查询
     * @author 剩xia的盛夏
     * @date 2023/02/24 16:16
     */
    @GetMapping("/{id}")
    @ApiOperation("根据ID查询")
    public ApiResponse finById(@PathVariable Integer id) {
        return ApiResponse.success(contestAnnouncementService.findById(id));
    }
}
